package com.zsyh.jiujiu.home;

import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.zyh.toolslib.base.BaseActivity;
import com.example.zyh.toolslib.widget.TitleBar;
import com.zsyh.jiujiu.R;
import com.zsyh.jiujiu.utils.ToastUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * @ProjectName: livvehelp
 * @Package: com.zsyh.lsb.ui
 * @ClassName:
 * @Description: java类作用描述
 * @Author: zsyh
 * @CreateDate: 2020/9/7 11:59
 * @UpdateUser: liangwanbo
 * @UpdateDate: 2020/9/7 11:59
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class SettingActivity extends BaseActivity {

    @BindView(R.id.title_bar)
    TitleBar titleBar;
    @BindView(R.id.clearn)
    RelativeLayout clearn;
    @BindView(R.id.youc)
    ImageView youc;
    @BindView(R.id.hao)
    TextView hao;
    @BindView(R.id.banben)
    RelativeLayout banben;

    @Override
    protected int initLayout() {
        return R.layout.activity_set;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {
        hao.setText(initLocalVersion());
    }

    @Override
    protected void initEvent() {
        titleBar.setLeftLayoutClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }



    @OnClick({R.id.clearn, R.id.banben})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.clearn:
                ToastUtils.showShort(thisActivity,"已清除缓存");
                break;
            case R.id.banben:

                break;
        }
    }

    public String initLocalVersion() {
        String mVersionName = "";
        try {
            PackageManager packageManager = getPackageManager();
            PackageInfo packageInfo = packageManager.getPackageInfo(this.getPackageName(), PackageManager.GET_CONFIGURATIONS);
            ApplicationInfo applicationInfo = packageManager.getApplicationInfo(this.getPackageName(), 0);
            //mVersionCode = packageInfo.versionCode;
            mVersionName = packageInfo.versionName;

        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        } finally {

        }
        return mVersionName;
    }
}
